package projet_v1.simulation.events;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import projet_v1.Character;
import projet_v1.Human;
import projet_v1.Item;
import projet_v1.Vampire;
import projet_v1.items.help.Food;
import projet_v1.simulation.Field;
import projet_v1.simulation.Location;

public class TestRescue {

	private Rescue r;

	@Before
	public void setUp() throws Exception {
		r = new Rescue(new Location(4, 4));
	}

	@After
	public void tearDown() throws Exception {
		r = null;
	}

	@Test
	public void testHappend() {
		Location loc = new Location(4, 4);
		Field f = new Field(8, 8);
		List<Character> characters = new ArrayList<Character>();

		r.happend(characters, f);

		List<Location> locations = f.adjacentLocations(loc, 1);
		locations.add(loc);

		int itemCounter = 0;

		for (Location l : locations) {
			List<Item> i = f.getItemsAt(l);
			for (Item item : i) {
				if ((item.getTypeItem() >= 0) && (item.getTypeItem() <= 3))
					itemCounter++;
			}
		}

		assertEquals(9, itemCounter);
	}

}
